package com.wy2cloud.authorize.repository;

import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import com.wy2cloud.authorize.entity.AuthorizeRole;



/** 
 * AuthorizeRole 仓储层
 * @author wuyy(16349023@qq.com)
 * @date 2018年04月04日 14:24:30
 *
 */
public interface AuthorizeRoleRepository extends JpaRepository<AuthorizeRole, String> {

    @Query(value="SELECT role.* from authorize_role role LEFT JOIN authorize_user_role userRole on role.id=userRole.role_id where userRole.user_id=?1",nativeQuery=true)
    List<AuthorizeRole> listUserRoles(String userId);
}